package messageMeUtility.chats;

import messageMeUtility.interfaces.IMessage;
import messageMeUtility.interfaces.IUser;

public class TextChat extends AbstactChat {

	public TextChat() {
		super();
	}

	public void addUser(IUser user) {
		this.users.add(user);
	}

	public void removeUser(IUser user) {
		this.users.remove(user);
	}

	public void addMessage(IMessage message) {
		this.messages.add(message);
	}

	public String getChatContent() {
		String result;

		StringBuilder sb = new StringBuilder();

		for (IMessage message : messages) {
			sb.append("[" + message.getTimestamp().toString() + "]");
			sb.append(" " + message.getUsername() + " says:");
			//sb.append(" " + message.GetText());
			sb.append("\n");
		}

		result = sb.toString();
		return result;
	}
}
